Comments for MEDB 5501, Week 13

Covariance

  • \(Cov(X,Y)=\frac{1}{n-1}\Sigma(X_i-\bar{X})(Y_i-\bar{Y})\)
    • \((X_i-\bar{X})(Y_i-\bar{Y})\) is positive if
      • \(X_i\) and \(Y_i\) both above average
      • \(X_i\) and \(Y_i\) both below average
    • \((X_i-\bar{X})(Y_i-\bar{Y})\) is negative if
      • \(X_i\) above average and \(Y_i\) below average
      • \(X_i\) below average and \(Y_i\) above average

  x  y
 11 13
 15  9
 19 15
 21  7
 25 11
 29  5

\(\ \)

\(\bar{X}=20\);

\(\bar{Y}=10\);

\(S_X=6.5\);

\(S_Y=3.7\)

The covariance measures how much each value deviates from the mean. Notice for two of the data points in the upper left corner of the graph, the X value is below average and the Y value is above average.

There is only one data point in the lower left corner, representing a data value where both X and Y are below average.

There are two points in the lower right corner, representing a data value where X is above average and Y is below average.

Finally, there is a single point in the upper right corner, representing a data value where both X and Y are above average.

Calculation of covariance

 x_centered y_centered product
          9         -5     -45
          1         -3      -3
         -5         -1       5
          5          1       5
         -9          3     -27
         -1          5      -5

\(\ \)

  • \(Cov(X,Y)=\frac{1}{5}(-70)=-14\)

Correlation

  • \(Corr(X,Y)=\frac{Cov(X,Y)}{S_XS_Y}\)
    • Also use \(r_{XY}\)
    • Population correlation is \(\rho_{XY}\)

Calculation of correlation

  • \(r_{XY}=\frac{-14}{6.5 \times 3.7}=-0.571929\)
    • Always round!
      • \(r_{XY}=-0.57\) or \(-0.6\)

Interpretation of correlation

  • r is always between -1 and +1
    • Positive values imply positive association
    • Negative values imply negative association
    • Strongest associations closest to -1 or +1

r between -1 and -0.7, strong negative association

r between -0.7 and -0.3, weak negative association

r between -0.3 and +0.3, little or no association

r between +0.3 and +0.7, weak positive association

r between +0.7 and +1, strong positive association

Extreme case, perfect association

Sleep data dictionary, 1 of 6

---
data_dictionary:
  sleep.txt
  
source:
  This dataset is part of the Austrasian Data and
  Story Library (OZDASL). Please cite this data as
  Smyth, GK (2011). Australasian Data and Story 
  Library (OzDASL). http://www.statsci.org/data.
  The data comes originally from Allison, T., and
  Cicchetti, D. V. (1976). Sleep in mammals. 
  ecological and constitutional correlates. 
  Science 194 (November 12), 732-734.

Sleep data dictionary, 2 of 6

description:
  This dataset has information about sleep patterns
  in 62 common mammals, along with other information
  that might help you understand what influences
  variations in sleep.
  
download:
  text-format: http://www.statsci.org/data/general/sleep.txt
  additional-information: http://www.statsci.org/data/general/sleep.html

copyright:
  There is no information about the copyright for this
  dataset. You should, however, be able to use this
  data for individual educational purposes under the
  Fair Use guidelines of U.S. copyright law.

Sleep data dictionary, 3 of 6

format: 
  delimiter: tab
  varnames: included in the first row of data
  missing-value-code: NA
  rows: 62
  columns: 11

Sleep data dictionary, 4 of 6

vars:
  Species:
    label: Species of mammal
    
  BodyWt:
    label: Body weight
    unit: kg
    
  BrainWt:
    label: Brain weight
    unit: g
    

Sleep data dictionary, 5 of 6

  NonDreaming:
    label: Time spent in non-dreaming sleep
    unit: hours
    
  Dreaming:
    label: Time spent in dreaming sleep
    unit: hours
    
  TotalSleep:
    label: Total time spent in sleep
    unit: hours
    
  LifeSpan:
    unit: years
    

Sleep data dictionary, 6 of 6

  Gestation:
    unit: days

  Predation:
    scale: likert
    range: 1-5

  Exposure:
    scale: likert
    range: 1-5
    
  Danger:
    scale: likert
    range: 1-5
---

SPSS analysis, 1 of 9

SPSS analysis, 2 of 9

SPSS analysis, 3 of 9

SPSS analysis, 4 of 9

SPSS analysis, 5 of 9

SPSS analysis, 6 of 9

SPSS analysis, 7 of 9

SPSS analysis, 8 of 9

SPSS analysis, 9 of 9

SPSS analysis, 10 of 9

SPSS analysis, 11 of 9

Partial correlation

  • \(\rho_{XY\cdot Z}=\frac{\rho_{XY}-\rho_{XZ}\rho_{ZY}} {\sqrt{1-\rho_{XZ}^2}\sqrt{1-\rho_{ZY}^2}}\)